import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    TouchableOpacity,
    Navigator,
    Image,
    BackAndroid,
    Dimension
} from 'react-native';
var Dimensions = require('Dimensions');
const { width, height } = Dimensions.get('window');
import { StackNavigator,TabNavigator,DrawerNavigator, DrawerItems, DrawerItem } from 'react-navigation';
import SelectCity from './app/components/SelectCity';
import denglu from './app/pages/denglu';
import ActiveList from './app/pages/ActiveList';
import AddAnimals from './app/pages/AddAnimals';
import AddGoods from './app/pages/AddGoods';
import AddList from './app/pages/AddList';
import AddStore from './app/pages/AddStore';
import EditStore from './app/pages/EditStore';
import AgentCard from './app/pages/AgentCard';
import BaiduMap from './app/pages/BaiduMap';
import Explain from './app/pages/Explain';
import GoodsDetails from './app/pages/GoodsDetails';
import GoodsManage from './app/pages/GoodsManage';
import QuestionFeedback from './app/pages/QuestionFeedback';
import guanyupeita from './app/pages/guanyupeita';
import LeftPage from './app/pages/LeftPage';
import MemberDetails from './app/pages/MemberDetails';
import Message from './app/pages/Message';
import Mine from './app/pages/Mine';
import Monitor from './app/pages/Monitor';
import NewMessage from './app/pages/NewMessage';
import PublicAnimals from './app/pages/PublicAnimals';
import PublicTask from './app/pages/PublicTask';
import querendingdan from './app/pages/querendingdan';
import Qun from './app/pages/Qun';
import ReminPage from './app/pages/ReminPage';
import root from './app/pages/root';
import SafeOfAccount from './app/pages/SafeOfAccount';
import ScanCode from './app/pages/ScanCode';
import SettingPage from './app/pages/SettingPage';
import ShopCar from './app/pages/ShopCar';
import ShoppingList from './app/pages/ShoppingList';
import StoreReview from './app/pages/StoreReview';
import SubmitInfo from './app/pages/SubmitInfo';
import yuyuexiangqing from './app/pages/yuyuexiangqing';
import zhuce from './app/pages/zhuce';
import Info from './app/pages/Info';
import CreateClub from './app/pages/CreateClub';
import AddLabel from './app/pages/AddLabel';
import ClubDetails from './app/pages/ClubDetails';
import ClubMember from './app/pages/ClubMember';
import InformationDetails from './app/pages/InformationDetails';
import AnimalDetails from './app/pages/AnimalDetails';
import AddFriend from './app/pages/AddFriend';
import ChoseClubAddress from './app/pages/ChoseClubAddress';
import Search from './app/pages/Search';
import FriendsList from './app/pages/FriendsList';
import EditActive from './app/pages/EditActive';
import HistoryList from './app/pages/HistoryList';
import BankCard from './app/pages/BankCard';
import DrawCash from './app/pages/DrawCash';
import BankCardList from './app/pages/BankCardList';
import DrawRecord from './app/pages/DrawRecord';
import CardList from './app/pages/CardList';
import EditUser from './app/pages/EditUser';
const homePage = TabNavigator({  
    店铺: {
        screen:root,
        navigationOptions : {
            tabBarLabel: '店铺',
            // Note: By default the icon is only shown on iOS. Search the showIcon option below.
            tabBarIcon: ({ tintColor }) => (
                <Image
                    source={require('./app/img/icon/home.png')}
                    style={[styles.icon, {tintColor: tintColor}]}/>
            ),
            header:null,
        }
    },  
    消息:{
        screen:Message,
        navigationOptions : {
            tabBarLabel: '消息',
            // Note: By default the icon is only shown on iOS. Search the showIcon option below.
            tabBarIcon: ({ tintColor }) => (
                <Image
                    source={require('./app/img/icon/xiaoxi.png')}
                    style={[styles.icon, {tintColor: tintColor}]}/>
            ),
            header:null,
        }
    },
    日志:{
        screen:Info,
        navigationOptions : {
            tabBarLabel: '日志',
            // Note: By default the icon is only shown on iOS. Search the showIcon option below.
            tabBarIcon: ({ tintColor }) => (
                <Image
                    source={require('./app/img/icon/rizhi.png')}
                    style={[styles.icon, {tintColor: tintColor}]}/>
            ),
            header:null,
        }
    },
    我的:{
        screen:Mine,
        navigationOptions : {
            tabBarLabel: '我的',
            // Note: By default the icon is only shown on iOS. Search the showIcon option below.
            tabBarIcon: ({ tintColor }) => (
                <Image
                    source={require('./app/img/icon/wode.png')}
                    style={[styles.icon, {tintColor: tintColor}]}/>
            ),
            header:null,
        }
    } 
},
{
    animationEnabled: false, // 切换页面时是否有动画效果
    tabBarPosition: 'bottom', // 显示在底端，android 默认是显示在页面顶端的
    swipeEnabled: false, // 是否可以左右滑动切换tab
    backBehavior: 'none', // 按 back 键是否跳转到第一个Tab(首页)， none 为不跳转
    lazy:true,
    lazyLoad:true,
    tabBarOptions: {tabBarIcon:{focused: true},
        activeTintColor: '#fff', // 文字和图片选中颜色
        inactiveTintColor: '#ccc', // 文字和图片未选中颜色
        showIcon: true, // android 默认不显示 icon, 需要设置为 true 才会显示
        indicatorStyle: {
            height: 0  // 如TabBar下面显示有一条线，可以设高度为0后隐藏
        }, 
        style: {
            backgroundColor: 'rgb(79,145,237)', // TabBar 背景色
            height:60
        },
        activeBackgroundColor:'rgb(110,202,255)',
        labelStyle: {
            fontSize: 14, // 文字大小
        },
        scrollEnabled:false,
    }, 
});

const Left = DrawerNavigator({
    homePage: { screen: homePage },  
}, {
    header:null,
    drawerWidth: width*7/10, // 抽屉宽
    drawerPosition: 'left', // 抽屉在左边还是右边
    contentComponent: LeftPage,  // 自定义抽屉组件
});
const PeitaMerchants = StackNavigator({
    denglu:{screen:denglu},
    // Left:{screen:Left},
    LeftPage:{screen:LeftPage},
    homePage:{screen: homePage},
    ActiveList :{screen:ActiveList},
    AddAnimals :{screen:AddAnimals},
    AddGoods :{screen:AddGoods},
    AddList :{screen:AddList},
    AddStore :{screen:AddStore},
    EditStore :{screen:EditStore},
    AgentCard :{screen:AgentCard},
    BaiduMap :{screen:BaiduMap},
    Explain :{screen:Explain},
    GoodsDetails :{screen:GoodsDetails},
    GoodsManage :{screen:GoodsManage},
    QuestionFeedback :{screen:QuestionFeedback},
    guanyupeita :{screen:guanyupeita},
    MemberDetails :{screen:MemberDetails},
    Monitor :{screen:Monitor},
    NewMessage :{screen:NewMessage},
    PublicAnimals :{screen:PublicAnimals},
    PublicTask :{screen:PublicTask},
    querendingdan :{screen:querendingdan},
    Qun :{screen:Qun},
    ReminPage :{screen:ReminPage},
    SafeOfAccount :{screen:SafeOfAccount},
    ScanCode :{screen:ScanCode},
    SettingPage :{screen:SettingPage},
    ShopCar :{screen:ShopCar},
    ShoppingList :{screen:ShoppingList},
    StoreReview :{screen:StoreReview},
    SubmitInfo :{screen:SubmitInfo},
    yuyuexiangqing :{screen:yuyuexiangqing},
    zhuce :{screen:zhuce},
    SelectCity :{screen:SelectCity},
    CreateClub :{screen:CreateClub},
    AddLabel :{screen:AddLabel},
    ClubDetails :{screen:ClubDetails},
    ClubMember :{screen:ClubMember},
    InformationDetails :{screen:InformationDetails},
    AnimalDetails :{screen:AnimalDetails},
    AddFriend :{screen:AddFriend},
    ChoseClubAddress :{screen:ChoseClubAddress},
    Search :{screen:Search},
    FriendsList :{screen:FriendsList},
    EditActive :{screen:EditActive},
    HistoryList :{screen:HistoryList},
    BankCard :{screen:BankCard},
    DrawCash :{screen:DrawCash},
    BankCardList :{screen:BankCardList},
    DrawRecord :{screen:DrawRecord},
    CardList :{screen:CardList},
    EditUser :{screen:EditUser},
},{
    mode: 'card',
    animationEnabled:true,
    navigationOptions: {
        header:null,
    },
    initialRouteName: 'denglu',
})

const styles = StyleSheet.create({
    icon: {
        width: 26,
        height: 26,
        marginTop:2
    },
});
AppRegistry.registerComponent('PeitaMerchants', () => PeitaMerchants);